//
//  UIBarButtonItem+LJExtension.m
//  百思不得姐
//
//  Created by 刘鹿杰 on 16/7/5.
//  Copyright © 2016年 刘鹿杰. All rights reserved.
//

#import "UIBarButtonItem+LJExtension.h"
#import "UIView+LJExtension.h"

@implementation UIBarButtonItem (LJExtension)


+(UIBarButtonItem *)itemWithImageName:(NSString *)imageName hightedImage:(NSString *)hightedImage target:(id)target action:(SEL)action{
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:hightedImage] forState:UIControlStateHighlighted];
    btn.size = btn.currentBackgroundImage.size;
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return  [[UIBarButtonItem alloc] initWithCustomView:btn];
    
}


@end
